package com.bjgzy.rating.di.module;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.bjgzy.rating.mvp.contract.SignUp3Contract;
import com.bjgzy.rating.mvp.model.SignUp3Model;
import com.bjgzy.rating.mvp.model.entity.SignUp3Data;
import com.bjgzy.rating.mvp.ui.adapter.UploadAdapter;
import com.jess.arms.di.scope.ActivityScope;

import java.util.ArrayList;
import java.util.List;

import dagger.Module;
import dagger.Provides;

/**
 * @author xubo
 * @date 2018-8-26 17:08:16
 */
@Module
public class SignUp3Module {
    private SignUp3Contract.View view;

    /**
     * 构建SignUp3Module时,将View的实现类传进来,这样就可以提供View的实现类给presenter
     *
     * @param view
     */
    public SignUp3Module(SignUp3Contract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    SignUp3Contract.View provideSignUp3View() {
        return this.view;
    }

    @ActivityScope
    @Provides
    SignUp3Contract.Model provideSignUp3Model(SignUp3Model model) {
        return model;
    }

    @ActivityScope
    @Provides
    List<SignUp3Data> provideLists() {
        return new ArrayList<>();
    }

    @ActivityScope
    @Provides
    RecyclerView.LayoutManager provideLayoutManager() {
        return new GridLayoutManager(view.getActivity(), 3);
    }

    @ActivityScope
    @Provides
    UploadAdapter providerAdapter(List<SignUp3Data> lists) {
        return new UploadAdapter(lists);
    }
}